
$(function() {
	jQuery.fn.stickyNotes.notes = new Array();
	
	var id = function() {
		// alert("Created note with id " + note.id + ", text : " + note.text);
		// alert($.toJSON(note));
		
		var url = 'info.php?do=NoteMy.note_id';
		var ret = 0;
		$.ajax({
			type: "POST",
			url: 'info.php?do=NoteMy.note_id',
			async: false,
			success: function(json) {
				ret = json;
			}
		});
		
		// alert(ret);
		
		return ret;
	}
	
	var created = function(note) {
		// alert("Created note with id " + note.id + ", text : " + note.text);
		// alert($.toJSON(note));
		
		var url = 'info.php?do=NoteMy.insert';
	}

	var edited = function(note) {		
		var url = 'info.php?do=NoteMy.update';
		$.post(url, note);
	}
	
	var deleted = function(note) {		
		var url = 'info.php?do=NoteMy.hide';
		$.post(url, note);
	}

	var moved = function(note) {
		
		var url = 'info.php?do=NoteMy.update';
		$.post(url, note);
	}

	var resized = function(note) {		
		var url = 'info.php?do=NoteMy.update';
		$.post(url, note);
	}
		
	var options = {notes:data, idCallback: id, createCallback: created, editCallback: edited, deleteCallback: deleted, moveCallback: moved, resizeCallback: resized}
	
	$("#notes").stickyNotes(options);
});
